#2017年省赛-程序设计题 九宫幻方
'''先想所有可能情况
2 9 4  2 7 6  4 9 2  4 3 8  6 1 8  6 7 2  8 1 6  8 3 4
7 5 3  9 5 1  3 5 7  9 5 1  7 5 3  1 5 9  3 5 7  1 5 9
6 1 8  4 3 8  8 1 6  2 7 6  2 9 4  8 3 4  4 9 2  6 7 2'''
d = []
for _ in range(3):
    d.append(list(map(int, input().split())))

d1 = [[2, 9, 4], [7, 5, 3], [6, 1, 8]]
d2 = [[2, 7, 6], [9, 5, 1], [4, 3, 8]]
d3 = [[4, 9, 2], [3, 5, 7], [8, 1, 6]]
d4 = [[4, 3, 8], [9, 5, 1], [2, 7, 6]]
d5 = [[6, 1, 8], [7, 5, 3], [2, 9, 4]]
d6 = [[6, 7, 2], [1, 5, 9], [8, 3, 4]]
d7 = [[8, 1, 6], [3, 5, 7], [4, 9, 2]]
d8 = [[8, 3, 4], [1, 5, 9], [6, 7, 2]]

num = 0
for i in [d1, d2, d3, d4, d5, d6, d7, d8]:
    flag = 1
    for j in range(3):
        for k in range(3):
            if d[j][k] != 0 and d[j][k] != i[j][k]:
                flag = 0
    if flag:
        num += 1
        result =i
if num >= 2:
    print('Too Many')
else:
    for i in result:
        print(*i)
